{% macro gen_table(prices) %}
    <style>
        .width-10 {
            width: 10%
        }

        .width-15 {
            width: 15%
        }
    </style>
    <div id="table-content">
        <table id="price-table"
               class="table table-bordered table-hover table-condensed table-striped">
            <thead>
            <tr>
                <th>是否计算</th>
                <th>产品类型</th>
                <th>产品名</th>
                <th>参数</th>
                <th>数量</th>
                <th>单价</th>
                <th>总价</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for item in prices %}
                {% if item and item.necessary %}
                    <tr>
                        <td class="width-10"><input type="checkbox"
                                                      checked=true
                                                      disabled=disabled>
                        </td>
                        <td class="width-15">{{ item.product_type }}</td>
                        <td class="width-10">{{ item.product_name }}</td>
                        <td class="width-15">{{ item.spec_display or '' }}</td>
                        <td class="width-10">{{ item.quantity or 0 }}</td>
                        <td class="width-10">{{ item.price }}</td>
                        <td class="width-10">{{ item.total }}</td>
                        <td class="width-10">
                            {% if item.modifiable %}
                                <div class="col-xs-4">
                                    <a class="btn btn-group btn-xs btn-primary"
                                       href="javascript:;"
                                       data-toggle="modal"
                                       data-target="#notice-preview-modal"
                                       data-type_id="{{ item.type_id }}"
                                       data-product_type_id="{{ item.product_type_id }}"
                                       data-product_id={{ item.product_id }}
                                       data-href="{{ url_for('compute_bp.ajax_option_products') }}">更改产品</a>
                                </div>
                            {% endif %}
                        </td>
                    </tr>
                {% endif %}
            {% endfor %}
            </tbody>
        </table>
        <div class="well well-sm text-center text-info">可选附加项</div>
        <table id="price-table-add"
               class="table table-bordered table-hover table-condensed table-striped">
            <tbody>
            {% for item in prices %}
                {% if item and not item.necessary %}
                    <tr>
                        <td class="width-10"><input class="is-add-price"
                                                      type="checkbox"
                                                      data-total={{ item.total }}>
                        </td>
                        <td class="width-15">{{ item.product_type }}</td>
                        <td class="width-10">{{ item.product_name }}</td>
                        <td class="width-15">{{ item.spec_display or '' }}</td>
                        <td class="width-10">{{ item.quantity or 0 }}</td>
                        <td class="width-10">{{ item.price }}</td>
                        <td class="total width-10">{{ item.total }}</td>
                        <td class="width-10">
                            {% if item.modifiable %}
                                <div class="form-group col-xs-4">
                                    <a class="btn btn-group btn-xs btn-primary"
                                       href="javascript:;"
                                       data-toggle="modal"
                                       data-target="#notice-preview-modal"
                                       data-type_id={{ item.type_id }}
                                       data-product_type_id={{ item.product_type_id }}
                                       data-product_id={{ item.product_template_id }}
                                       data-href="{{ url_for('compute_bp.ajax_option_products') }}">更改产品</a>
                                </div>
                            {% endif %}
                        </td>
                    </tr>
                {% endif %}
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endmacro %}
